<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simSaveImage</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1>Regular API function</h1>
<h3 class=subsectionBar><a name="simSaveImage" id="simSaveImage"></a>simSaveImage / sim.saveImage </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Saves an image to file or to memory. See also <a href="simLoadImage.htm">sim.loadImage</a>, <a href="simGetScaledImage.htm">sim.getScaledImage</a> and <a href="simGetVisionSensorCharImage.htm">sim.getVisionSensorCharImage</a>.</td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved)</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>image</strong>: a pointer to rgb, rgba or greyscale values.</div>
<div><strong>resolution</strong>: the x/y resolution of the provided image.</div>
<div><strong>options</strong>: bit-coded. If bit0 and bit1 represent the format of the provided image (0=rgb, 1=rgba, 2=greyscale).</div>
<div><strong>filename</strong>: the name of the file to write. The file extension indicates the format.</div>
<div><strong>quality</strong>: the quality of the written image: 0 for best compression, 100 for largest file. Use -1 for default behaviour.</div>
<div><strong>reserved</strong>: Reserved for future extension. Set to nullptr.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>
<div>string imgBuffer=sim.saveImage(string image,table[2] resolution,int options,string filename,int quality)</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div><strong>image</strong>:  the image (in rgb, rgba or greyscale format)</div>
<div><strong>resolution</strong>: the x/y resolution of the provided image.</div>
<div><strong>options</strong>: bit-coded. If bit0 and bit1 represent the format of the provided image (0=rgb, 1=rgba, 2=greyscale).</div>
<div><strong>filename</strong>: the name of the file to write. The file extension indicates the format. If the filename only contains '.xxx', where xxx represents the file format, then the image will be saved to memory</div>
<div><strong>quality</strong>: the quality of the written image: 0 for best compression, 100 for largest file. Use -1 for default behaviour.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div><strong>imgBuffer</strong>: a buffer containing the image in packed format (e.g. png, jpg, etc.), if the image was specified to be saved to memory.</div>
</td> 
</tr> 
</table> 


<br>
</td>
</tr>
</table>
</div>
</body>
</html>
